# This is the Main Program for the Automated Testing Package

require "watir"
require "watir/testcase"
require 'test/unit/ui/console/testrunner'

#This is for loading Custom Libraries.
require "lib/std_lib.rb"

# This is for Loading our Scipts. To add a new script add the following: require "<testscriptname>"
require "Sales/OrgSearch.rb"
require "Sales/Listing Management/AdministratorSearch.rb"
require "Sales/Listing Management/ListingAssignment.rb"



class Main
  include Test::Unit::UI::Console
  
  CRM.new("https://crmint.dev.activenetwork.com/admin/orgcrm/login.cfm")
  
  $log = Reporting.new('D:\\Automation Report\\')
  
  # Calls the Login function
  CRM.Login("yangke", "yangke2009")
 
  # Usage: testcases = [<class1>, <class2>, <class3>]          
  testcases = [class1, class2, class3]
  
  # Iteration through each test case held in the testcases object
  testcases.each {|testcase| 
    $log.set_case(testcase)
    TestRunner.run(testcase)
  }
  $log.set_case("")
  
  # Calls the Logout() function from std_lib to Logut from testing website
  CRM.Logout()
  
  # Calls the Close() function from ReportingLib to save, and properly close Excel
  $log.Close()
  
  # Calls the Close() function from std_lib to close the testing website
  ACR.Close()
end